﻿using System;
using fastCSharp;
using diantou.examDataAccess;

namespace diantou.web.emanagement
{
    /// <summary>
    /// 问题集合
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class problemList : permissionView<problemList>
    {
        /// <summary>
        /// 问题集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private exam.userProblem[] problems;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        private bool loadView(int page, diantou.dataAccess.problem.showType showType, int userId)
        {
            if ((currentUser.Permission & dataModel.user.permission.ExamEditor) != 0)
            {
                diantou.examDataAccess.examProblem[] values = clientCache.ExamProblem.Get(diantou.examDataAccess.tcpCall.examProblem.getIds(showType, userId, pageInfo.Size = 20, pageInfo.Page = page, currentUserId, out pageInfo.Count));
                //if (currentUser.Permission != dataModel.user.permission.Admin)
                //{
                //    foreach (diantou.examDataAccess.examProblem value in values) value.UsedCount = 0;
                //}
                problems = values.getArray(value => new exam.userProblem { Problem = value, User = currentUser });
                return true;
            }
            AjaxResponse(new fastCSharp.code.cSharp.webView.errorPath { ErrorPath = currentUser.Path.NewFocus });
            return false;
        }
    }
}
